package com.itheima.homework8.firstwork.two;

import java.util.Iterator;
import java.util.TreeSet;

public class Test01 {
    public static void main(String[] args) {
        TreeSet<Student> ts=new TreeSet<>();
        ts.add(new Student("zhangsan",23));
        ts.add(new Student("lisi",24));
        ts.add(new Student("wangwu",25));
        ts.add(new Student("zhaoliu",23));
        ts.add(new Student("tianqi",23));
        //迭代器
        Iterator<Student> it = ts.iterator();
        while (it.hasNext()) {
            Student next = it.next();
            System.out.println("next = " + next);
        }
    }
}
